// ===================================
// <copyright>
// This file is part of LABSMFController.
//
//    LABSMFController is free software: you can redistribute it and/or modify
//    it under the terms of the GNU General Public License as published by
//    the Free Software Foundation, either version 3 of the License, or
//    (at your option) any later version.
//
//    LABSMFController is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//    GNU General Public License for more details.
//
//    You should have received a copy of the GNU General Public License
//    along with LABSMFController.  If not, see <http://www.gnu.org/licenses/>.
//    Copyright 2011 David Bakker
//
//</copyright>
// <author>David Bakker</author>
// <email>mailto:DavidFBakker@gmail.com</email>
// <created>Saturday, May 07, 2011</created>
// <lastedit>Saturday, May 07, 2011</lastedit>
// ===================================

using GHIElectronics.NETMF.FEZ;

using Microsoft.SPOT.Hardware;

namespace LABSMFController.LABS.Devices
{

    #region Nested type: PumpDevice

    public class PumpDevice
    {
        private readonly OutputPort _outputPort;

        public PumpDevice(string description, FEZ_Pin.Digital pin)
        {
            Description = description;
            PIN = pin;
            PINString = pin.ToString();
            _outputPort = new OutputPort((Cpu.Pin) PIN, false);
            Header = "Description,PINString,IsOn";
         
        }        
       
        public string Description { get; private set; }
        private FEZ_Pin.Digital PIN { get; set; }
        public string PINString { get; private set; }
        public bool IsOn { get; private set; }
        public string Header { get; set; }

        public string GetClientOutPut()
        {
            string ret = Description + "," + PINString + "," + IsOn + ";";
            return ret;
        }

        public void TurnOn()
        {
            _outputPort.Write(true);
            IsOn = true;
        }

        public void TurnOff()
        {
            _outputPort.Write(false);
            IsOn = false;
        }
    }

    #endregion
}